﻿<Window x:Class="WPF_QCCM.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:System="clr-namespace:System;assembly=mscorlib"
        xmlns:local="clr-namespace:WPF_QCCM"
        Title="QC Configuration Manager" Height="768" Width="1024">
    <Window.Resources>
        <ObjectDataProvider x:Key="dataFromEnum" MethodName="GetValues" ObjectType="{x:Type System:Enum}">
            <ObjectDataProvider.MethodParameters>
                <x:Type TypeName="local:AttribMeasurementTypes"/>
            </ObjectDataProvider.MethodParameters>
        </ObjectDataProvider>
    </Window.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />

        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="100" />
            <RowDefinition Height="23" />
            <RowDefinition Height="538"/>
            <RowDefinition Height="23"/>
            <RowDefinition Height="80" />
        </Grid.RowDefinitions>
        <Border Grid.Row="0" Grid.ColumnSpan="2" Background="#dfdddb" >
            <Image Source="C:\Users\mshaugh0\Google Drive\ReachIT Main Project\UI-QCCM\WPF_QCCM\images\logo.PNG" HorizontalAlignment="Left" Margin="32,0,0,0" Width="226" Height="48" VerticalAlignment="Center" />
        </Border>
        <Border Grid.Row="1" Grid.ColumnSpan="2" Background="Black" />
        <Border Grid.Row="3" Grid.ColumnSpan="2" Background="Black" />
        <Border Grid.Row="4" Grid.ColumnSpan="2" Background="#dfdddb" />

        <TabControl Grid.Row="2" HorizontalAlignment="Center" Height="492" VerticalAlignment="Center" Width="974" Margin="10,25,10,21" >
            <TabItem Header="Materials/Attributes">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="219"/>
                        <ColumnDefinition Width="268"/>
                        <ColumnDefinition Width="487"/>
                    </Grid.ColumnDefinitions>
                    <GroupBox x:Name="grpMaterials" Header="Materials" HorizontalAlignment="Left" Height="405" Margin="19,30,0,0" VerticalAlignment="Top" Width="445" Grid.ColumnSpan="2">
                        <Grid>
                            <Label x:Name="lblMname" Content="Name:" HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="44,12,0,0" VerticalAlignment="Top"/>
                            <TextBox x:Name="txtMname" HorizontalAlignment="Left" Height="22" Margin="93,14,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="175"/>
                            <Label x:Name="lblMdescription" Content="Description:" HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="15,46,0,0" VerticalAlignment="Top"/>
                            <TextBox x:Name="txtMdescription" HorizontalAlignment="Left" Height="46" Margin="93,46,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="175"/>
                            <CheckBox x:Name="chkMdisabled" Content="Disable Material" HorizontalAlignment="Left" Margin="128,105,0,0" VerticalAlignment="Top"/>

                            <Button x:Name="btnAddMaterial" KeyboardNavigation.IsTabStop="False" Content="Add New Material" HorizontalAlignment="Left" Margin="282,14,0,0" VerticalAlignment="Top" Width="118" IsEnabled="{Binding ElementName=txtMname, Path=Text.Length, Mode=OneWay}" Click="btnAddMaterial_Click"/>
                            <Button x:Name="btnSaveMaterial" KeyboardNavigation.IsTabStop="False" Content="Save" HorizontalAlignment="Left" Margin="305,14,0,0" VerticalAlignment="Top" Width="65"  Visibility="Collapsed" Click="btnSaveMaterial_Click"/>
                            <Button x:Name="btnDeleteMaterial" KeyboardNavigation.IsTabStop="False" Content="Delete" HorizontalAlignment="Left" Margin="305,49,0,0" VerticalAlignment="Top" Visibility="Collapsed" Width="65" Click="btnDeleteMaterial_Click"/>
                            <Button x:Name="btnMcancel" KeyboardNavigation.IsTabStop="False" Content="Cancel" HorizontalAlignment="Left" Margin="305,83,0,0" VerticalAlignment="Top" Visibility="Collapsed" Width="65" Click="btnMcancel_Click"/>

                            <TextBox x:Name="txtMsearch" HorizontalAlignment="Left" Height="22" Margin="160,178,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="162" KeyDown="txtMsearch_KeyDown"/>
                            <Label x:Name="lblMsearch" HorizontalContentAlignment="Right" Content="Search Materials:" HorizontalAlignment="Left" Margin="44,178,0,0" VerticalAlignment="Top" Width="111"/>
                            <Button x:Name="btnMsearch" KeyboardNavigation.IsTabStop="False" Content="Search" HorizontalAlignment="Left" Margin="330,179,0,0" VerticalAlignment="Top" Width="75" Click="btnMsearch_Click"/>

                            <DataGrid x:Name="dgdMaterials" KeyboardNavigation.TabNavigation="None" CanUserAddRows="false" IsReadOnly="True" AutoGenerateColumns="False" HorizontalAlignment="Left" Height="156" Margin="14,209,0,0"
                                      ItemsSource="{Binding Source=Materials}" VerticalAlignment="Top" Width="406" SelectionChanged="dgdMaterials_SelectionChanged" Initialized="dgdMaterials_Initialized">
                                <DataGrid.Columns>
                                    <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="Name" Width="100" Binding="{Binding Path=MaterialName}" />
                                    <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="Description" Width="*" Binding="{Binding Path=MaterialDescription}" />
                                    <DataGridCheckBoxColumn KeyboardNavigation.IsTabStop="False" Header="Disabled?" Width="50" Binding="{Binding Path=MaterialDisabled}" />
                                </DataGrid.Columns>
                            </DataGrid>

                        </Grid>
                    </GroupBox>


                    <GroupBox x:Name="grpAttributes" Header="Attributes" HorizontalAlignment="Left" Height="405" Margin="17,30,0,0" VerticalAlignment="Top" Width="445" Grid.Column="2" KeyboardNavigation.TabNavigation="Local">
                        <Grid>
                            <Label x:Name="lblAname" Content="Name:" HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="44,12,0,0" VerticalAlignment="Top"/>
                            <TextBox x:Name="txtAname" KeyboardNavigation.TabIndex="0" HorizontalAlignment="Left" Height="22" Margin="93,14,0,0" TextWrapping="Wrap" Text="{Binding SelectedItem.Name, ElementName=dgdAttributes}" VerticalAlignment="Top" Width="175" />
                            <Label x:Name="lblAdescription" Content="Description:" HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="15,46,0,0" VerticalAlignment="Top"/>
                            <TextBox x:Name="txtAdescription" KeyboardNavigation.TabIndex="1" HorizontalAlignment="Left" Height="45" Margin="93,46,0,0" TextWrapping="Wrap" Text="{Binding SelectedItem.Desc, ElementName=dgdAttributes}" VerticalAlignment="Top" Width="175"/>
                            <Label x:Name="lblDataType" Content="Data Type:" HorizontalAlignment="Left" HorizontalContentAlignment="Right" Margin="15,102,0,0" VerticalAlignment="Top" Width="73"/>
                            <TextBox x:Name="txtDataType" KeyboardNavigation.TabIndex="2" HorizontalAlignment="Left" Height="22" Margin="93,102,0,0" TextWrapping="Wrap" Text="{Binding SelectedItem.TypeOfData, ElementName=dgdAttributes}" VerticalAlignment="Top" Width="175"/>
                            <CheckBox x:Name="chkAdisabled" KeyboardNavigation.TabIndex="3" Content="Disable Attribute" HorizontalAlignment="Left" Margin="128,137,0,0" VerticalAlignment="Top" IsChecked="{Binding SelectedItem.Disabled, ElementName=dgdAttributes}"/>

                            <Button x:Name="btnAddQCAttribute" KeyboardNavigation.IsTabStop="False" Content="Add New Attribute" HorizontalAlignment="Left" Margin="282,14,0,0" VerticalAlignment="Top" Width="118" IsEnabled="{Binding ElementName=txtAname, Path=Text.Length, Mode=OneWay}" Click="btnAddAttribute_Click"/>
                            <Button x:Name="btnSaveAttribute" KeyboardNavigation.IsTabStop="False" Content="Save" HorizontalAlignment="Left" Margin="305,14,0,0" VerticalAlignment="Top" Width="65" Visibility="Collapsed" Grid.Column="1" Click="btnSaveAttribute_Click"/>
                            <Button x:Name="btnDeleteAttribute" KeyboardNavigation.IsTabStop="False" Content="Delete" HorizontalAlignment="Left" Margin="305,49,0,0" VerticalAlignment="Top" Width="65" Visibility="Collapsed" Grid.Column="1" Click="btnDeleteAttribute_Click"/>
                            <Button x:Name="btnAcancel" KeyboardNavigation.IsTabStop="False" Content="Cancel" HorizontalAlignment="Left" Margin="305,83,0,0" VerticalAlignment="Top" Width="65" Visibility="Collapsed" Grid.Column="1" Click="btnAcancel_Click"/>

                            <TextBox x:Name="txtAsearch" KeyboardNavigation.TabIndex="4" HorizontalAlignment="Left" Height="23" Margin="160,178,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="162" KeyDown="txtAsearch_KeyDown"/>
                            <Label x:Name="lblAsearch" HorizontalContentAlignment="Right" Content="Search Attributes:" HorizontalAlignment="Left" Margin="44,178,0,0" VerticalAlignment="Top" Width="111"/>
                            <Button x:Name="btnAsearch" KeyboardNavigation.IsTabStop="False" Content="Search" HorizontalAlignment="Left" Margin="330,179,0,0" VerticalAlignment="Top" Width="75" Click="btnAsearch_Click" />

                            <DataGrid x:Name="dgdAttributes" KeyboardNavigation.TabNavigation="None" IsReadOnly="True" HorizontalAlignment="Left" Height="156" Margin="14,209,0,0" VerticalAlignment="Top" Width="406" AutoGenerateColumns="False" 
                                      ItemsSource="{Binding Source=QCAttribs}" Initialized="dgdAttributes_Initialized" SelectionChanged="dgdAttributes_SelectionChanged" CanUserAddRows="false">
                                <DataGrid.Columns>
                                    <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="Name" Width="100" Binding="{Binding Path=Name}">

                                    </DataGridTextColumn>
                                    <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="Description" Width="*" Binding="{Binding Path=Desc}" />
                                    <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="Data Type" Width="70" Binding="{Binding Path=TypeOfData}" />
                                    <DataGridCheckBoxColumn KeyboardNavigation.IsTabStop="False" Header="Disabled?" Width="60" Binding="{Binding Path=Disabled}" />
                                </DataGrid.Columns>
                            </DataGrid>

                        </Grid>
                    </GroupBox>
                </Grid>
            </TabItem>
            <TabItem Header="Material QC Attributes" Height="23" VerticalAlignment="Bottom">
                <Grid>
                    <ListBox x:Name="lstMaterials_2" HorizontalAlignment="Left" Height="131" VerticalAlignment="Top" Width="194" Margin="53,73,0,0" ScrollViewer.VerticalScrollBarVisibility="Visible" ItemsSource="{Binding Source=Materials, Path=MaterialName}" Initialized="lstMaterials_2_Initialized" SelectionChanged="lstMaterials_2_SelectionChanged" />
                    <TextBox x:Name="txtMsearch_2" HorizontalAlignment="Left" Height="24" Margin="55,45,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="138"/>
                    <Button x:Name="btnMsearch_2" Content="Search" HorizontalAlignment="Left" Margin="198,46,0,0" VerticalAlignment="Top" Width="49" Click="btnMsearch_2_Click" KeyDown="btnMsearch_2_KeyDown"/>
                    <Label Content="Search for a material:" HorizontalAlignment="Left" Margin="55,22,0,0" VerticalAlignment="Top" FontStyle="Italic" Width="128"/>

                    <ListBox x:Name="lstAttributes_2" HorizontalAlignment="Left" Height="131" VerticalAlignment="Top" Width="194" Margin="293,73,0,0" ScrollViewer.VerticalScrollBarVisibility="Visible" ItemsSource="{Binding Source=QCAttribs, Path=Name}" Initialized="lstAttributes_2_Initialized" SelectionChanged="lstAttributes_2_SelectionChanged"/>
                    <TextBox x:Name="txtAsearch_2" HorizontalAlignment="Left" Height="24" Margin="295,45,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="138"/>
                    <Button x:Name="btnAsearch_2" Content="Search" HorizontalAlignment="Left" Margin="438,46,0,0" VerticalAlignment="Top" Width="49"/>
                    <Label Content="Search for an attribute:" HorizontalAlignment="Left" Margin="295,22,0,0" VerticalAlignment="Top" FontStyle="Italic" Width="138"/>

                    <ComboBox x:Name="cboType" HorizontalAlignment="Left" Margin="542,47,0,0" VerticalAlignment="Top" Width="126" ItemsSource="{Binding Source={StaticResource dataFromEnum}}" 
                              SelectionChanged="cboType_SelectionChanged" Initialized="cboType_Initialized" />
                    <Label Content="Select Measurement Type:" HorizontalAlignment="Left" Margin="531,21,0,0" VerticalAlignment="Top" FontStyle="Italic"/>
                    <TextBox x:Name="txtTarget" HorizontalAlignment="Left" Height="23" Margin="545,105,0,332" Visibility="Hidden" Width="120"/>
                    <Label x:Name="Target" Content="Target:" Margin="543,82,372,350" Visibility="Hidden" />
                    <TextBox x:Name="txtTolerance" HorizontalAlignment="Left" Height="23" Margin="545,156,0,280" Visibility="Hidden" Width="120"/>
                    <Label x:Name="Tolerance" Content="Tolerance (percentage):" Margin="543,133,282,302" Height="25" VerticalContentAlignment="Center" Visibility="Hidden" />
                    <Label x:Name="Percent" Content="%" HorizontalAlignment="Left" Margin="662,156,0,0" VerticalAlignment="Top" Visibility="Hidden" />
                    <TextBox x:Name="txtHigh" HorizontalAlignment="Left" Height="23" Margin="545,105,0,332" Visibility="Hidden" Width="120"/>
                    <Label x:Name="High" Content="High Limit:" Margin="544,82,347,349" Visibility="Hidden" />
                    <TextBox x:Name="txtLow" HorizontalAlignment="Left" Height="23" Margin="545,156,0,280" Visibility="Hidden" Width="120"/>
                    <Label x:Name="Low" Content="Low Limit:" Margin="544,133,356,299" Visibility="Hidden" />
                    <Label Content="Enable/Disable:" HorizontalAlignment="Left" Margin="751,22,0,0" VerticalAlignment="Top" FontStyle="Italic"/>
                    <CheckBox x:Name="chkMQCAdisabled" Content="Disable Material QC Attribute" HorizontalAlignment="Left" Margin="721,49,0,0" VerticalAlignment="Top" />

                    <Button x:Name="btnAddMQCA" Content="Add New" HorizontalAlignment="Left" Margin="760,86,0,0" VerticalAlignment="Top" Width="86" Visibility="Visible" Click="btnAddMQCA_Click" />
                    <Button x:Name="btnSaveMQCA" Content="Save" HorizontalAlignment="Left" Margin="765,86,0,0" VerticalAlignment="Top" Width="76" Visibility="Hidden" Click="btnSaveMQCA_Click" />
                    <Button x:Name="btnDeleteMQCA" Content="Delete" HorizontalAlignment="Left" Margin="765,118,0,0" VerticalAlignment="Top" Width="76" Visibility="Hidden" Click="btnDeleteMQCA_Click"  />
                    <Button x:Name="btnCancelMQCA" Content="Cancel" HorizontalAlignment="Left" Margin="765,150,0,0" VerticalAlignment="Top" Width="76" Visibility="Hidden" Click="btnCancelMQCA_Click" />
                    <Label x:Name="lbl_mqca" Content="Material QC Attributes:" Margin="62,218,766,212" />
                    <DataGrid x:Name="dgdMQCAttribs" KeyboardNavigation.TabNavigation="None" IsReadOnly="True" HorizontalAlignment="Left" Margin="55,242,0,0" VerticalAlignment="Top" Height="198" Width="791"
                              ScrollViewer.VerticalScrollBarVisibility="Visible" AutoGenerateColumns="False" ItemsSource="{Binding Source=MQCAttribs}" CanUserAddRows="False" Initialized="dgdMQCAttribs_Initialized" SelectionChanged="dgdMQCAttribs_SelectionChanged" >
                        <DataGrid.Columns>
                            <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="Material Name" Width="140" Binding="{Binding Path=MaterialName}">
                                <DataGridTextColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader">
                                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                                    </Style>
                                </DataGridTextColumn.HeaderStyle>
                            </DataGridTextColumn>
                            <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="QC Attribute Name" Width="140" Binding="{Binding Path=QCAttribName}">
                                <DataGridTextColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader">
                                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                                    </Style>
                                </DataGridTextColumn.HeaderStyle>
                            </DataGridTextColumn>
                            <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="Measurement Type" Width="*" Binding="{Binding Path=MeasurementType}">
                                <DataGridTextColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader">
                                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                                    </Style>
                                </DataGridTextColumn.HeaderStyle>
                            </DataGridTextColumn>
                            <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="Target" Width="70" Binding="{Binding Path=Target}">
                                <DataGridTextColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader">
                                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                                    </Style>
                                </DataGridTextColumn.HeaderStyle>
                            </DataGridTextColumn>
                            <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="Threshold" Width="70" Binding="{Binding Path=Threshold}">
                                <DataGridTextColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader">
                                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                                    </Style>
                                </DataGridTextColumn.HeaderStyle>
                            </DataGridTextColumn>
                            <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="Upper" Width="70" Binding="{Binding Path=Upper}">
                                <DataGridTextColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader">
                                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                                    </Style>
                                </DataGridTextColumn.HeaderStyle>
                            </DataGridTextColumn>
                            <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="Lower" Width="70" Binding="{Binding Path=Lower}">
                                <DataGridTextColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader">
                                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                                    </Style>
                                </DataGridTextColumn.HeaderStyle>
                            </DataGridTextColumn>
                            <DataGridCheckBoxColumn KeyboardNavigation.IsTabStop="False" Header="Disabled?" Width="63" Binding="{Binding Path=MaterialQCADisabled}" />
                        </DataGrid.Columns>
                    </DataGrid>


                </Grid>
            </TabItem>
            <TabItem Header="Quality Control Schedules">
                <Grid>
                    <TextBox x:Name="txtMsearch_3" HorizontalAlignment="Left" Height="24" Margin="45,25,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="138"/>
                    <Button x:Name="btnMsearch_3" Content="Search" HorizontalAlignment="Left" Margin="188,26,0,0" VerticalAlignment="Top" Width="49"/>
                    <Label Content="Filter by material:" HorizontalAlignment="Left" Margin="45,2,0,0" VerticalAlignment="Top" FontStyle="Italic" Width="128"/>
                    <TextBox x:Name="txtAsearch_3" HorizontalAlignment="Left" Height="24" Margin="285,25,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="138"/>
                    <Button x:Name="btnAsearch_3" Content="Search" HorizontalAlignment="Left" Margin="428,26,0,0" VerticalAlignment="Top" Width="49"/>
                    <Label Content="Filter by attribute:" HorizontalAlignment="Left" Margin="285,2,0,0" VerticalAlignment="Top" FontStyle="Italic" Width="138"/>

                    <DataGrid x:Name="dgdMQCAttribs_2" KeyboardNavigation.TabNavigation="None" IsReadOnly="True" HorizontalAlignment="Left" Margin="43,55,0,0" VerticalAlignment="Top" Height="118" Width="434"
                              ScrollViewer.VerticalScrollBarVisibility="Visible" AutoGenerateColumns="False" ItemsSource="{Binding Source=MQCAttribs}" CanUserAddRows="False" >
                        <DataGrid.Columns>
                            <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="Material ID" Width="215" Binding="{Binding Path=MaterialID}">
                                <DataGridTextColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader">
                                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                                    </Style>
                                </DataGridTextColumn.HeaderStyle>
                            </DataGridTextColumn>
                            <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="QC Attribute ID" Width="*" Binding="{Binding Path=QCAttribID}">
                                <DataGridTextColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader">
                                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                                    </Style>
                                </DataGridTextColumn.HeaderStyle>
                            </DataGridTextColumn>
                        </DataGrid.Columns>
                    </DataGrid>

                    <ComboBox x:Name="cboDay" HorizontalAlignment="Left" Margin="537,50,0,0" VerticalAlignment="Top" Width="125"/>
                    <Label Content="Select a day:"  HorizontalContentAlignment="Center" HorizontalAlignment="Left" Margin="560,26,0,0" VerticalAlignment="Top" Width="79" FontStyle="Italic"/>
                    <ComboBox x:Name="cboTime" HorizontalAlignment="Left" Margin="537,108,0,0" VerticalAlignment="Top" Width="125"/>
                    <Label Content="Select a time:" HorizontalContentAlignment="Center"  HorizontalAlignment="Left" Margin="556,84,0,0" VerticalAlignment="Top" Width="87" FontStyle="Italic"/>
                    <CheckBox Content="Disabled"  HorizontalContentAlignment="Center" HorizontalAlignment="Left" Margin="569,166,0,0" VerticalAlignment="Top" Width="62"/>
                    <Label Content="Enable/Disable:" HorizontalContentAlignment="Center" HorizontalAlignment="Left" Margin="552,143,0,0" VerticalAlignment="Top" Width="95" FontStyle="Italic"/>

                    <Button x:Name="AddQCsched" Content="Add New" HorizontalAlignment="Left" Margin="701,50,0,0" VerticalAlignment="Top" Width="86" Visibility="Visible" />
                    <Button x:Name="SaveQCsched" Content="Save" HorizontalAlignment="Left" Margin="706,50,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" />
                    <Button x:Name="DeleteQCsched" Content="Delete" HorizontalAlignment="Left" Margin="706,82,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" />
                    <Button x:Name="CancelQCsched" Content="Cancel" HorizontalAlignment="Left" Margin="706,115,0,0" VerticalAlignment="Top" Width="75" Visibility="Hidden" />

                    <Label Content="Material QC Attribute Schedules:" HorizontalAlignment="Left" Margin="43,203,0,0" VerticalAlignment="Top" Height="34" Width="190"/>
                    <DataGrid x:Name="dgdSchedules" HorizontalAlignment="Left" Height="211" Margin="40,227,0,0" VerticalAlignment="Top" Width="741" AutoGenerateColumns="False" Initialized="dgdSchedules_Initialized"
                              ScrollViewer.VerticalScrollBarVisibility="Visible" CanUserAddRows="False" >
                        <DataGrid.Columns>
                            <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="Material ID" Width="140" Binding="{Binding Path=MaterialID}">
                                <DataGridTextColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader">
                                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                                    </Style>
                                </DataGridTextColumn.HeaderStyle>
                            </DataGridTextColumn>
                            <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="QC Attribute ID" Width="140" Binding="{Binding Path=QCAttribID}">
                                <DataGridTextColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader">
                                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                                    </Style>
                                </DataGridTextColumn.HeaderStyle>
                            </DataGridTextColumn>
                            <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="Hour" Width="70" Binding="{Binding Path=Hour}">
                                <DataGridTextColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader">
                                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                                    </Style>
                                </DataGridTextColumn.HeaderStyle>
                            </DataGridTextColumn>
                            <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="Day" Width="*" Binding="{Binding Path=Day}">
                                <DataGridTextColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader">
                                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                                    </Style>
                                </DataGridTextColumn.HeaderStyle>
                            </DataGridTextColumn>
                            <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="Group ID" Width="70" Binding="{Binding Path=GroupID}">
                                <DataGridTextColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader">
                                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                                    </Style>
                                </DataGridTextColumn.HeaderStyle>
                            </DataGridTextColumn>
                            <DataGridTextColumn KeyboardNavigation.IsTabStop="False" Header="Disabled?" Width="70" Binding="{Binding Path=Disabled}">
                                <DataGridTextColumn.HeaderStyle>
                                    <Style TargetType="DataGridColumnHeader">
                                        <Setter Property="HorizontalContentAlignment" Value="Center" />
                                    </Style>
                                </DataGridTextColumn.HeaderStyle>
                            </DataGridTextColumn>
                        </DataGrid.Columns>
                    </DataGrid>
                </Grid>
            </TabItem>
        </TabControl>

    </Grid>
</Window>
